import { TUserInFoResult } from '@/api/sys/type'
import { RouteRecordRaw } from 'vue-router'
import { Commit, Dispatch } from 'vuex'

// user modules for vuex
export interface IUserState {
  token: string | undefined;
  currentRouters: Array<RouteRecordRaw>;
  userInfo: TUserInFoResult | object;
}

// common modules for vuex
export interface IDictType {
  id: string;
  typeValue: string;
  code: string;
}

export interface IPageTab {
  title: string | undefined;
  key: string;
}

export interface ICommonState {
  loading: boolean;
  dictData: Map<string, Array<IDictType>>;
  pageTabs: Array<IPageTab>;
}

export interface IDictKeyV {
  key: string;
  value: Array<IDictType>;
}

export interface ICtx<T> {
  dispatch: Dispatch;
  commit: Commit;
  state: T;
}

// 后端返回格式
export type TResponse<T> = {
  state: boolean;
  result: T;
  msg: string;
}

interface ITableSolts {
  customRender: string;
}

// 表格参数
export interface ITableColums {
  dataIndex: string | undefined;
  title: string;
  slots?: ITableSolts;
}
